package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.MoreBannerBean;
import com.lwj.liwanjia.impl.MoreBannerView;
import com.lwj.liwanjia.model.MoreBannerModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/9/26.
 */

public class MoreBannerPresenter {
    private MoreBannerModel moreBannerModel;
    private MoreBannerView moreBannerView;

    public MoreBannerPresenter(MoreBannerView moreBannerView) {
        this.moreBannerView = moreBannerView;
        moreBannerModel = new MoreBannerModel();
    }

    public void getMoreBanner() {
        if (moreBannerView != null) {
            moreBannerModel.getMoreBanner( new Subscriber<MoreBannerBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    moreBannerView.showError((Exception) e);
                }

                @Override
                public void onNext(MoreBannerBean moreBannerBean) {
                    moreBannerView.getMoreBanner(moreBannerBean);
                }
            });
        }
    }
}
